<template>
  <div class=''>
    <div>
      <p>2020-03-17 15:30:00 时间+2分钟的结果</p>
      <div>{{timeStrAddTenMinute}}</div>
    </div>
    <div>
      <p>2020-03-17 15:30:00 时间-2分钟的结果</p>
      <div>{{timeStrSubTenMinute}}</div>
    </div>
  </div>
</template>

<script>
import { formatDate } from '@/utils'
export default {
  name: 'timeDemo',
  data () {
    return {

    }
  },
  computed: {
    timeStrAddTenMinute () {
      let timeStr = '2020-03-17 15:30:00'
      timeStr = new Date(new Date(timeStr).getTime() + 2 * 60 * 1000)
      return formatDate(timeStr)
    },
    timeStrSubTenMinute () {
      let timeStr = '2020-03-17 15:30:00'
      timeStr = new Date(new Date(timeStr).getTime() - 2 * 60 * 1000)
      return formatDate(timeStr)
    }
  }
}
</script>
<style lang='less' scoped>
</style>
